# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=emacs-f
pkgver=0.20.0_git20240307
_gitrev=1e7020dc0d4c52d3da9bd610d431cab13aa02d8c
pkgrel=0
_pkgreal=f
pkgdesc="Modern API for working with files and directories in Emacs"
url="https://github.com/rejeep/f.el"
arch="noarch"
license="GPL-3.0-or-later"
depends="
	cmd:emacs
	emacs-dash
	emacs-s
	"
makedepends="emacs-nox"
source="https://github.com/rejeep/f.el/archive/$_gitrev/emacs-f-$_gitrev.tar.gz"
builddir="$srcdir/f.el-$_gitrev"
options="!check" # tests require unpackaged "undercover"

build() {
	emacs -batch -q -no-site-file -L . \
		-eval '(setq byte-compile-error-on-warn t)' \
		-f batch-byte-compile \
		./*.el
}

check() {
	emacs -batch -q -no-site-file -L . -L test \
		-l f-init -f ert-run-tests-batch-and-exit
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/

	cd "$pkgdir"/usr/share/emacs/site-lisp
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
680de5a75ac9225024905a1ab14251c7eb78ee35a34c42da2566573f06e97a34cc7a643434b5d7dd65519cce24a01ae35b287e5baaff032f242fe10fabed1963  emacs-f-1e7020dc0d4c52d3da9bd610d431cab13aa02d8c.tar.gz
"
